home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 1995 #5 & #6 / Amiga Plus CD - 1995 - No. 5 and 6.iso / pd / netz / amislate / examplerexx / wait.rexx < prev   
OS/2 REXX Batch file  |  1995-08-05  |  3KB  |  60 lines

  1. /* An ARexx script to demonstrate how to use WaitEvent.
  2.    Whenever the user does a detectable action, this script will
  3.    print out info about it to the console.  Set REXXOUTPUT=con:
  4.    in your startup arguments/ToolType arguments to see this output */
  5.    
  6. parse arg CommandPort ActiveString
  7.  
  8. address (CommandPort)
  9. options results
  10.  
  11. /* Constants for use with AmiSlate's ARexx interface */
  12.  
  13. AMode.DOT      =  0 /* Two words: x,y */
  14. AMode.PEN      =  1 /* Stream of words x,y,x,y,... until STOP_STRING */
  15. AMode.LINE     =  2 /* Two words: x,y */
  16. AMode.CIRCLE   =  3 /* Three words: x,y,r */
  17. AMode.SQUARE   =  4 /* Four words: x1,y1,x2,y2 */
  18. AMode.POLY     =  5 /* Stream of words x,y,x,y,... until STOP_STRING */
  19. AMode.FLOOD    =  6 /* Two words: x,y */
  20. AMode.DTEXT    =  7 /* Stream of single words */
  21.  
  22. AMessage.TIMEOUT     = 1        /* No events occurred in specified time period */
  23. AMessage.MESSAGE     = 2        /* Message recieved from remote Amiga */
  24. AMessage.MOUSEDOWN   = 4        /* Left mouse button press in drawing area */
  25. AMessage.MOUSEUP     = 8        /* Left mouse button release in drawing area */
  26. AMessage.RESIZE      = 16        /* Window was resized--time to redraw screen? */
  27. AMessage.QUIT        = 32        /* AmiSlate is shutting down */
  28. AMessage.CONNECT     = 64        /* Connection established */
  29. AMessage.DISCONNECT  = 128        /* Connection broken */
  30. AMessage.TOOLSELECT  = 256        /* Tool Selected */
  31. AMessage.COLORSELECT = 512        /* Palette Color selected */
  32. AMessage.KEYPRESS    = 1024        /* Key pressed */
  33.  
  34. do while (1=1)
  35.     WaitEvent RESIZE MESSAGE MOUSEDOWN MOUSEUP QUIT CONNECT DISCONNECT TOOLSELECT COLORSELECT KEYPRESS stem e.
  36.     t = e.type
  37.     if (t = AMessage.TIMEOUT) then        say 'Detected Event Timeout'
  38.     if (t = AMessage.MESSAGE) then        say 'Detected Remote Message'
  39.     if (t = AMessage.MOUSEDOWN) then   say 'Detected Mouse Down'
  40.     if (t = AMessage.MOUSEUP) then        say 'Detected Mouse Up'
  41.     if (t = AMessage.RESIZE)  then     say 'Detected Window Resize'
  42.     if (t = AMessage.CONNECT) then     say 'Detected Connect'
  43.     if (t = AMessage.DISCONNECT) then  say 'Detected DisConnect'
  44.     if (t = AMessage.TOOLSELECT) then  say 'Detected Tool Select'
  45.     if (t = AMessage.COLORSELECT) then say 'Detected Color Select'
  46.     if (t = AMessage.KEYPRESS) then    say 'Detected Key Press'
  47.  
  48.     if (t = AMessage.QUIT) then say "QUIT!!!"
  49.     if (t = AMessage.DISCONNECT) then say "Disconnect"
  50.  
  51.     say 'X:  ' e.x
  52.     say 'Y:  ' e.y
  53.     say 'Code1: ' e.code1
  54.     say 'Code2: ' e.code2
  55.     say 'Message: ' e.message
  56.     say '----------------------'
  57.     if (t = AMessage.QUIT) then exit
  58.     end
  59.  
  60.